#pragma once

#include "tool.h"

class MouseTool : public Tool
{
protected:
	/** where in the image the mouse is pointing */
	SRect m_tool;
	/** where on the screen the mouse rectangle is being drawn */
	SRect m_toolOnScreen;
	/** the mouse is pressed, and the user might be dragging it */
	int m_usingTool;
public:
	MouseTool(void * a_context):Tool(a_context),m_usingTool(SDLK_UNKNOWN){}
	/** generic event handling for mouse-driven editing tools */
	bool handleEvent(const SDL_Event & e);
	/** updates the position of the editing and drawing area */
	virtual void updateCursor(const SPoint & a_mouse);
	/** @return the area on screen */
	SRect * getArea(){return &m_toolOnScreen;}
	/** @return the area in the editor */
	inline SRect * getEditArea(){return &m_tool;}
	/** @return the mouse button being pressed */
	inline int getMouseButtonPressed(){return m_usingTool;}

	/** @return true if mouse press code was handled */
	virtual bool pressedTool(const int & a_mouseButton) = 0;
	/** @return true if mouse drag code was handled */
	virtual bool draggedTool(const int & a_mouseButton) = 0;
	/** @return true if mouse release code was handled */
	virtual bool releasedTool(const int & a_mouseButton) = 0;
};